package com.supreme.secretserver.config;

import com.supreme.secretserver.props.BaseConfigProps;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ConditionalOnClass
@Configuration
@EnableConfigurationProperties(value = {BaseConfigProps.class})
public class SecretConfig {

    private final BaseConfigProps baseConfigProps;

    public SecretConfig(BaseConfigProps baseConfigProps) {
        this.baseConfigProps = baseConfigProps;
    }

    @Bean
    public String securityUsername() {
        return baseConfigProps.getUsername();
    }

    @Bean
    public String securityPassword() {
        return baseConfigProps.getPassword();
    }
}
